package scalaLearning.scalaBasic

import scala.actors.Actor
/*
给Actor发消息
 */
class HelloActor extends Actor{
  def act(){
    while (true){//循环接消息
      receive{
        case name:String => println("Hello, " + name)
        case money:Int => println("How much? " + money)
      }
    }
  }
}

object HelloActor{
  def main(args: Array[String]) {
    val helloActor = new HelloActor
    helloActor.start()
    helloActor ! 100//给actor发消息 ！后边加上你要发送的消息
    helloActor ! "Leibn"//给actor发消息 ！后边加上你要发送的消息
  }
}